package com.wenhao.interview.pinduoduo;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-25 18:50
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[][] LR = new int[N][2];
        for (int i = 0;i < N;i++) {
            LR[i][0] = scanner.nextInt();
            LR[i][1] = scanner.nextInt();
        }
        Arrays.sort(LR, new Comparator<int[]>() {
            @Override
            public int compare(int[] l1, int[] l2) {
                if (l1[0] == l2[0]) {
                    return l1[1] - l2[1];
                }
                return l1[0] - l2[0];
            }
        });
        int max = LR[0][1];
        for (int i = 1;i < N;i++) {
            if (LR[i][1] <= max) {
                System.out.println(true);
                return;
            }
            max = max > LR[i][1] ? max : LR[i][1];
        }
        System.out.println(false);
    }
}
